package be.fedict.eid.diagnostics.system.data;

public class SystemService {

	String displayName;
	String serviceName;
	int processId;
	int status;
	int serviceType;

    public static enum STATE {
	
        PENDING("state_pending"), 
        PAUSE_PENDING("state_pause_pending"), 
        PAUSED("state_paused"), 
        RUNNING("state_running"),
        START_PENDING("state_start_pending"), 
        STOP_PENDING("state_stop_pending"), 
        STOPPED("state_stopped"),
        UNKNOWN("state_unknown");
        
        private final String state;

        private STATE(String state)
        {
            this.state = state;
        }

        @Override
        public String toString()
        {
            return this.state;
        }
    };	
	
    public static enum TYPE {
	
        DEVICE_DRIVER("type_device_driver"), 
        FILE_SYSTEM_DRIVER("type_file_system_driver"), 
        RUNNING_IN_OWN_PROCESS("type_running_own_process"), 
        RUNNING_IN_SHARED_PROCESS("type_running_in_shared_process"),
        UNKNOWN("type_unknown");
        
        private final String state;

        private TYPE(String state)
        {
            this.state = state;
        }

        @Override
        public String toString()
        {
            return this.state;
        }
    };	
    
	public int getServiceTypeId() {
		return serviceType;
	}
	public void setServiceType(int serviceType) {
		this.serviceType = serviceType;
	}
	
	public int getProcessId() {
		return processId;
	}
	public void setProcessId(int processId) {
		this.processId = processId;
	}
	
	public int getStatusId() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	
	public String getDisplayName() {
		return displayName;
	}
	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}
	
	public String getServiceName() {
		return serviceName;
	}
	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}
	
	public TYPE getServiceType() {
		switch(serviceType) {
		case 0x00000001: return TYPE.DEVICE_DRIVER;
		case 0x00000002: return TYPE.FILE_SYSTEM_DRIVER;
		case 0x00000010: return TYPE.RUNNING_IN_OWN_PROCESS;
		case 0x00000020: return TYPE.RUNNING_IN_SHARED_PROCESS;
		default: return TYPE.UNKNOWN;
		}
	}
	
	public STATE getStatus() {
		switch(status) {
		case 0x00000005: return STATE.PENDING;
		case 0x00000006: return STATE.PAUSE_PENDING;
		case 0x00000007: return STATE.PAUSED;
		case 0x00000004: return STATE.RUNNING;
		case 0x00000002: return STATE.START_PENDING;
		case 0x00000003: return STATE.STOP_PENDING;
		case 0x00000001: return STATE.STOPPED;
		default: return STATE.UNKNOWN;
		
		}
	}
	
}
